<html xmlns="http://www.w3.org/1999/html">
<head>
    <title>产品列表</title>
</head>
<style>

    label {
        display: inline-block;
        width: 100px;
    }

</style>
<body>

<form action="/products-add" method="post">

    <label>产品名称：</label>
    <input type="text" name="name" style="width:300px;"/><br/>

    <label>价格：</label>
    <input type="text" name="price"/><br/>

    <label>图片 url：</label>
    <input type="text" name="imgUrl" style="width:300px;"/><br/>

    <button type="submit">保存</button>

</form>

    <#list productList as product>

    <div style="border: 1px solid black; margin:10px; padding: 10px;">
        <div>产品名称：${product.name}</div>
        <div>价格：${product.price}</div>
        <div><img style="width: 300px;" src="${product.imgUrl}"/></div>
        <div>
            <a href="/products-edit/${product.id}">编辑</a>

            <form action="/products-del" method="post" onsubmit="return confirm('是否确认要删除？')">
                <input type="hidden" name="id" value="${product.id}"/>
                <button type="submit">删除</button>
            </form>

        </div>
    </div>

    </#list>

</body>
</html>